⚙️ App Functions Configuration
App Functions enable you to create custom reusable functions that can be called within workflows to perform specific logic or calculations.
Configuration Fields
- Name Enter a unique name for your function to identify it within your workflow system.
Params
Define the input parameters that your function accepts:
Field | Description |
---|---|
Parameter Name | Name of the parameter (e.g., "Initial Node") |
Type | Data type of the parameter (e.g., string, number, boolean) |
Initial Value | Default value assigned to the parameter |
Expression | (Optional) Use expressions or formulas to compute the value dynamically |
Use the + button to add more parameters or the trash icon to remove existing ones.
Return Types
Specify the data types and values your function returns:
Field | Description |
---|---|
Return Name | Name for the return value (e.g., "Initial Node") |
Type | Data type of the return value |
Initial Value | Default return value |
Expression | (Optional) Expression to dynamically determine the return value |
Add or remove return values similarly with + and trash buttons.
Example Use Cases
- Calculating derived data or metrics.
- Transforming input values for other workflow steps.
- Performing conditional logic within a reusable function.
Example: Function Definition
function calculateDiscount(price, discountRate) {
// Parameters
// price: Number - original price
// discountRate: Number - discount percentage (0-100)
const discount = (price * discountRate) / 100;
const finalPrice = price - discount;
// Return result as an object
return {
discountAmount: discount,
finalPrice: finalPrice,
};
}
Best Practices
- Clearly name parameters and return types for easier reuse.
- Use expressions to make your function dynamic and flexible.
- Keep functions focused on a single logical task.
This feature empowers you to modularize complex logic and reuse it across multiple workflows, improving maintainability and reducing redundancy.